package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @version v1.0.0
 * @Description:
 * @author: 赵英杰
 * @date: 2022.02.14
 * @since 1.0
 */
@RestController
public class LoginController {

    @RequestMapping("/login")
    public String login(String username, String password, String captcha, HttpSession session) {
        if ("qq".equals(username)) {
            return "error";
        }
        String captchaSession = (String)session.getAttribute("captcha");

        if (captcha != null && captcha.equalsIgnoreCase(captchaSession)) {
            return "success";
        }
        return "error";
    }
}
